package com.test.imagepuzzle.bean;

import android.graphics.Bitmap;
import android.graphics.Matrix;

public class Bmp {

	float preX = 0;
	float preY = 0;
	float width = 0;
	float height = 0;
	Bitmap pic = null;
	int priority = 0;
	Matrix matrix = new Matrix();

	public Bmp(Bitmap pic, int priority) {
		this.pic = pic;
		this.priority = priority;
	}

	public Bmp(Bitmap pic, int priority, float preX, float preY) {
		this(pic, priority);
		this.preX = preX + pic.getWidth() / 2 * 1.5f;
		this.preY = preY + pic.getHeight() / 2 * 1.5f;
	}

	public Bmp findByPiority(Bmp[] pic, int priority) {
		for (Bmp p : pic) {
			if (p.priority == priority) {
				return p;
			}
		}
		return null;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public float getXY(int i) {
		if (i == 1) {
			return this.preX;
		} else if (i == 2) {
			return this.preY;
		}
		return (Float) null;
	}

	public float getWidth() {
		return width;
	}

	public float getHeight() {
		return height;
	}

	public Bitmap getPic() {
		return pic;
	}

}
